
function validarCpf(){
    var cpf = document.getElementById("cpf").value;
    var expRegCpf = /^[0-9]{11}$/;
    
    if(cpf.search(expRegCpf) == -1){
        var elem = document.getElementById("cpf");
        elem.style.color = "red";
        return false;
    }else{
        var elem = document.getElementById("cpf");
        elem.style.color = "blue";
        return true;
    }
}